#ifndef LCDHC595_h
#define LCDHC595_h

#include <inttypes.h>

// Format of Print
#define DEC   10						// Decimal
#define HEX   16						// Hex
#define OCT   8						// Oct
#define BIN   2						// Binary
#define BCD   1                             	// BCD
#define BYTE  0						// Byte

//Command Code For Character LCD
#define  	lcd_clear_screen 		0x01			// Clear Display
#define  	lcd_cursor_home    	0x02			// Set Cursor = 0
#define  	lcd_display_on     	0x0E			// LCD Display Enable
#define  	lcd_display_off    	0x08			// LCD Display Disable
#define  	lcd_cursor_blink   	0x0F			// Set Cursor = Blink
#define  	lcd_cursor_on      	0x0E			// Enable LCD Cursor
#define  	lcd_cursor_off     	0x0C			// Disable LCD Cursor
#define  	lcd_cursor_left    	0x10			// Shift Left Cursor
#define  	lcd_cursor_right   	0x14			// Shift Right Cursor
#define  	lcd_display_sleft  	0x18			// Shift Left Display
#define 	lcd_display_sright 	0x1C			// Shift Right Display

class LCDHC595 
{
public:
  LCDHC595(int dat_pin, int str_pin, int clk_pin);  	// Signal Interface
  void Initial();  			 			// Initial LCD Display
  void Command(int value);  			 	      // Write Command
  void Print(char);
  void Print(const char[]);
  void Print(uint8_t);
  void Print(int);
  void Print(unsigned int);
  void Print(long);
  void Print(unsigned long);
  void Print(long, int);
  void SetCursor(int Cursor);					// Set Cursor(Set DDRAM Address)
  void ClearScreen(void);					// Clear Screen Display
  void ClearLCD(int Cursor, int length);              // Clear LCD From Cursor with length
  void Backlight(bool LED_Status);				// Backlight ON/OFF	
  
private:
  bool _Backlight_LED;						// Backlight LED Status
  void _Busy_LCD(bool lcd_command);
  void _Shift_Byte(int value, bool lcd_command);	// Shift Byte(Data,Command) to LCD
  void _Shift_Nibble(int nibble, bool lcd_command);	// Shift Nibble(4 Bit Data) to LCD
  void _Shift_HC595(int value);				// Shift Byte to 74HC595
  void _printNumber(unsigned long, uint8_t);
};

#endif
